package Book;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import FileOperation.*;

public class Bookshelf  {
    public List<Book> list = new ArrayList<>();//使用ArrayList存储，自动扩容

    public Bookshelf() throws SQLException {
        //将文件中的数据加载到list中
        new loadBooks().fileLoad(list);
    }

    public void Remove(int pos) {
        list.remove(pos);
    }

    public Book getBooks(int pos) {
        return list.get(pos);
    }

    public int getBooksNumber() {
        return list.size();
    }

    public void setBooks(int pos, Book book) {
        list.add(pos, book);
    }

    public void setBooks(Book book) {
        list.add(book);
    }

}
